package com.eee.xiang.market;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@MapperScan(basePackages = "com.eee.xiang.market.dao.mapper")
@SpringBootApplication
public class MarketApplication extends WebMvcConfigurerAdapter {

    @Value("${file.uploadFolder}")
    private String uploadFolder;


    public static void main(String[] args) {
        SpringApplication.run(MarketApplication.class, args);
    }


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/image/**").addResourceLocations("classpath:/static/image/");
        registry.addResourceHandler("/upload/**").addResourceLocations("file:" + uploadFolder);
        super.addResourceHandlers(registry);
    }
}

